package android.demo.engine;

import android.os.Bundle;

public class ProcessStateManager {

	public static final String ACTIVITY_TASK_ID = "curActTaskId";
	private Bundle variables;
	
	public ProcessStateManager(Bundle savedInstanceState){
		this.variables= new Bundle();
		loadState(savedInstanceState);
	}
	
	public void loadState(Bundle savedInstanceState) {
		if(savedInstanceState!=null)
			variables.putAll(savedInstanceState);
	}

	public String getString(String var){
		return variables.getString(var);
	}
	public int getInt(String var){
		return variables.getInt(var, 0);
	}
	
	public void putString(String varId,String varValue){
		variables.putString(varId, varValue);
	}
	
	public void putInt(String varId,int varValue){
		variables.putInt(varId, varValue);
	}

	public void clear() {
		this.variables.clear();
	}

	public void saveState(Bundle outState) {
		outState.putAll(variables);
	}
	public int getCurrentTaskId(){
		return getInt(ACTIVITY_TASK_ID);
	}
	public void setCurrentTaskId(int id){
		putInt(ACTIVITY_TASK_ID, id);
	}

	public void putLong(String key, long value) {
		variables.putLong(key, value);
	}
	public long getLong(String key){
		return variables.getLong(key);
	}
	
}
